package LeetCode;

//
// Created by ✎﹏ℳ๓独赏☆独醉 on 2024/5/5.
//
//https://leetcode.cn/problems/remove-element/submissions/529386546/
public class 移除元素 {
    public static void main(String[] args) {

    }
    public static int removeElement(int[] nums, int val) {
        int p = 0;
        for (int i = 0; i < nums.length; i++) {
            if(nums[i] != val){
                nums[p] = nums[i];
                p++;
            }
        }
        return p;
    }
}
